package com.kylin.system.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.kylin.common.core.entity.TreeEntity;
import com.kylin.common.core.validator.constraint.NotRepeat;
import lombok.Data;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;

/**
 * 部门表 sys_dept
 * 
 * @author wuhao
 */
@Data
@TableName("sys_dept")
@NotRepeat(field = "deptName", message = "部门名称已存在")
public class SysDept extends TreeEntity<SysDept>
{
    @TableId(type= IdType.AUTO)
    private Long id;

    /** 部门ID 方便数据权限查询 */
    private Long deptId;

    /** 部门名称 */
    @NotBlank(message = "部门名称不能为空")
    @Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符")
    private String deptName;

    /** 负责人 */
    private String leader;

    /** 联系电话 */
    @Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
    private String phone;

    /** 邮箱 */
    @Email(message = "邮箱格式不正确")
    @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
    private String email;

    @Override
    public String getLabel() {
        return this.deptName;
    }

}
